// ==================== 安全防护页面样式 ====================

/**
 * 安全防护页面主容器
 * @description 定义安全防护页面的整体布局和样式
 */

.security-page {
    min-height: 100vh;
    background-color: #f8fafc;
}


/**
 * 主要内容区域
 * @description 定义页面主要内容的布局
 */

.security-container {
    padding-top: 80px;
    min-height: calc(100vh - 80px);
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}


/**
 * 页面标题区域
 * @description 定义页面标题和描述的样式
 */

.page-header {
    text-align: center;
    margin-bottom: 3rem;
    .page-title {
        font-size: 2.5rem;
        font-weight: 700;
        color: #2c3e50;
        margin-bottom: 1rem;
        background: linear-gradient(135deg, #667eea, #764ba2);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    .page-description {
        font-size: 1.1rem;
        color: #7f8c8d;
        max-width: 600px;
        margin: 0 auto;
        line-height: 1.6;
    }
}


/**
 * 安全防护区域
 * @description 定义每个安全防护演示区域的样式
 */

.security-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    &:hover {
        transform: translateY(-2px);
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    }
}


/**
 * 区域头部
 * @description 定义区域标题和图标的样式
 */

.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
    .section-icon {
        width: 50px;
        height: 50px;
        background: linear-gradient(135deg, #667eea, #764ba2);
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 1.5rem;
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    }
    .section-content {
        flex: 1;
        .section-title {
            font-size: 1.8rem;
            font-weight: 600;
            color: #2c3e50;
            margin: 0 0 0.5rem 0;
        }
        .section-description {
            color: #7f8c8d;
            margin: 0;
            font-size: 1rem;
            line-height: 1.5;
        }
    }
}


/**
 * 演示内容区域
 * @description 定义演示内容的布局
 */

.demo-content {
    .demo-group {
        margin-bottom: 2rem;
        h3 {
            font-size: 1.3rem;
            font-weight: 600;
            color: #2c3e50;
            margin-bottom: 1rem;
        }
        .input-area {
            margin-bottom: 1rem;
        }
        .demo-buttons {
            display: flex;
            gap: 1rem;
            flex-wrap: wrap;
            margin-bottom: 2rem;
            .el-button {
                border-radius: 8px;
                font-weight: 500;
                transition: all 0.3s ease;
                &:hover {
                    transform: translateY(-2px);
                    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
                }
            }
        }
    }
}


/**
 * 结果显示区域
 * @description 定义XSS防护结果显示的样式
 */

.result-area {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    .result-group {
        background: rgba(248, 250, 252, 0.8);
        border-radius: 12px;
        padding: 1.5rem;
        border: 1px solid rgba(102, 126, 234, 0.1);
        h4 {
            font-size: 1.1rem;
            font-weight: 600;
            color: #2c3e50;
            margin: 0 0 1rem 0;
        }
        .result-content {
            min-height: 100px;
            padding: 1rem;
            border-radius: 8px;
            font-family: 'Courier New', monospace;
            font-size: 0.9rem;
            line-height: 1.5;
            word-break: break-all;
            &.original {
                background: rgba(239, 68, 68, 0.1);
                border: 1px solid rgba(239, 68, 68, 0.2);
                color: #dc2626;
            }
            &.safe {
                background: rgba(34, 197, 94, 0.1);
                border: 1px solid rgba(34, 197, 94, 0.2);
                color: #16a34a;
            }
            &.escaped {
                background: rgba(59, 130, 246, 0.1);
                border: 1px solid rgba(59, 130, 246, 0.2);
                color: #2563eb;
            }
        }
    }
}


/**
 * CSRF信息区域
 * @description 定义CSRF Token信息显示的样式
 */

.csrf-info {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
    .info-item {
        display: flex;
        align-items: center;
        gap: 1rem;
        padding: 1rem;
        background: rgba(248, 250, 252, 0.8);
        border-radius: 8px;
        border: 1px solid rgba(102, 126, 234, 0.1);
        .label {
            font-weight: 600;
            color: #2c3e50;
            min-width: 100px;
        }
        .value {
            font-family: 'Courier New', monospace;
            font-size: 0.9rem;
            word-break: break-all;
            &.valid {
                color: #16a34a;
            }
            &.invalid {
                color: #dc2626;
            }
        }
    }
}


/**
 * CSRF结果区域
 * @description 定义CSRF验证结果显示的样式
 */

.csrf-result {
    margin-top: 2rem;
    h4 {
        font-size: 1.1rem;
        font-weight: 600;
        color: #2c3e50;
        margin-bottom: 1rem;
    }
    .result-message {
        padding: 1rem;
        border-radius: 8px;
        font-weight: 500;
        &.success {
            background: rgba(34, 197, 94, 0.1);
            border: 1px solid rgba(34, 197, 94, 0.2);
            color: #16a34a;
        }
        &.error {
            background: rgba(239, 68, 68, 0.1);
            border: 1px solid rgba(239, 68, 68, 0.2);
            color: #dc2626;
        }
        &.warning {
            background: rgba(245, 158, 11, 0.1);
            border: 1px solid rgba(245, 158, 11, 0.2);
            color: #d97706;
        }
    }
}


/**
 * 验证表单区域
 * @description 定义输入验证表单的样式
 */

.validation-forms {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    .form-group {
        label {
            display: block;
            font-weight: 600;
            color: #2c3e50;
            margin-bottom: 0.5rem;
        }
        .el-input {
            margin-bottom: 0.5rem;
        }
        .validation-result {
            padding: 0.5rem;
            border-radius: 6px;
            font-size: 0.9rem;
            font-weight: 500;
            &.valid {
                background: rgba(34, 197, 94, 0.1);
                border: 1px solid rgba(34, 197, 94, 0.2);
                color: #16a34a;
            }
            &.invalid {
                background: rgba(239, 68, 68, 0.1);
                border: 1px solid rgba(239, 68, 68, 0.2);
                color: #dc2626;
            }
        }
    }
}


/**
 * 安全工具演示区域
 * @description 定义安全工具演示的样式
 */

.tools-demo {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    .tool-group {
        background: rgba(248, 250, 252, 0.8);
        border-radius: 12px;
        padding: 1.5rem;
        border: 1px solid rgba(102, 126, 234, 0.1);
        h4 {
            font-size: 1.1rem;
            font-weight: 600;
            color: #2c3e50;
            margin: 0 0 1rem 0;
        }
        .tool-result {
            display: flex;
            align-items: center;
            gap: 1rem;
            margin-top: 1rem;
            padding: 1rem;
            background: rgba(255, 255, 255, 0.8);
            border-radius: 8px;
            border: 1px solid rgba(102, 126, 234, 0.1);
            .label {
                font-weight: 600;
                color: #2c3e50;
                min-width: 80px;
            }
            .random-string {
                font-family: 'Courier New', monospace;
                font-size: 0.9rem;
                color: #667eea;
                background: rgba(102, 126, 234, 0.1);
                padding: 0.5rem;
                border-radius: 4px;
                flex: 1;
            }
            .safe-filename {
                font-family: 'Courier New', monospace;
                font-size: 0.9rem;
                color: #16a34a;
                background: rgba(34, 197, 94, 0.1);
                padding: 0.5rem;
                border-radius: 4px;
                flex: 1;
            }
            .json-result {
                font-family: 'Courier New', monospace;
                font-size: 0.8rem;
                color: #2563eb;
                background: rgba(59, 130, 246, 0.1);
                padding: 0.5rem;
                border-radius: 4px;
                flex: 1;
                max-height: 100px;
                overflow-y: auto;
            }
        }
    }
}


/**
 * 安全建议区域
 * @description 定义安全建议显示的样式
 */

.security-tips {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    .tip-item {
        background: rgba(248, 250, 252, 0.8);
        border-radius: 12px;
        padding: 1.5rem;
        border: 1px solid rgba(102, 126, 234, 0.1);
        h4 {
            font-size: 1.1rem;
            font-weight: 600;
            color: #2c3e50;
            margin: 0 0 1rem 0;
        }
        ul {
            list-style: none;
            padding: 0;
            margin: 0;
            li {
                padding: 0.5rem 0;
                color: #7f8c8d;
                font-size: 0.95rem;
                line-height: 1.5;
                position: relative;
                padding-left: 1.5rem;
                &::before {
                    content: '•';
                    color: #667eea;
                    font-weight: bold;
                    position: absolute;
                    left: 0;
                }
            }
        }
    }
}

// ==================== 响应式设计 ====================

/**
 * 移动端适配
 * @description 针对移动设备的样式调整
 */

@media (max-width: 768px) {
    .security-container {
        padding: 1rem;
    }
    .page-header {
        .page-title {
            font-size: 2rem;
        }
        .page-description {
            font-size: 1rem;
        }
    }
    .security-section {
        padding: 1.5rem;
    }
    .section-header {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
        .section-icon {
            width: 40px;
            height: 40px;
            font-size: 1.2rem;
        }
        .section-title {
            font-size: 1.5rem;
        }
    }
    .demo-content {
        .demo-buttons {
            flex-direction: column;
            .el-button {
                width: 100%;
            }
        }
    }
    .result-area {
        grid-template-columns: 1fr;
    }
    .validation-forms {
        grid-template-columns: 1fr;
    }
    .tools-demo {
        grid-template-columns: 1fr;
    }
    .security-tips {
        grid-template-columns: 1fr;
    }
    .csrf-info {
        .info-item {
            flex-direction: column;
            align-items: flex-start;
            gap: 0.5rem;
            .label {
                min-width: auto;
            }
        }
    }
    .tool-result {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        .label {
            min-width: auto;
        }
    }
}


/**
 * 平板端适配
 * @description 针对平板设备的样式调整
 */

@media (min-width: 769px) and (max-width: 1024px) {
    .result-area {
        grid-template-columns: repeat(2, 1fr);
    }
    .validation-forms {
        grid-template-columns: repeat(2, 1fr);
    }
    .tools-demo {
        grid-template-columns: repeat(2, 1fr);
    }
    .security-tips {
        grid-template-columns: repeat(2, 1fr);
    }
}

// ==================== 深色主题支持 ====================

/**
 * 深色主题样式
 * @description 当系统处于深色模式时的样式调整
 */

@media (prefers-color-scheme: dark) {
    .security-page {
        background-color: #1a1a1a;
    }
    .security-section {
        background: rgba(30, 30, 30, 0.95);
        border-color: rgba(255, 255, 255, 0.1);
    }
    .page-header {
        .page-title {
            color: #ecf0f1;
        }
        .page-description {
            color: #bdc3c7;
        }
    }
    .section-header {
        .section-content {
            .section-title {
                color: #ecf0f1;
            }
            .section-description {
                color: #bdc3c7;
            }
        }
    }
    .demo-content {
        .demo-group {
            h3 {
                color: #ecf0f1;
            }
        }
    }
    .result-area {
        .result-group {
            background: rgba(30, 30, 30, 0.8);
            border-color: rgba(102, 126, 234, 0.2);
            h4 {
                color: #ecf0f1;
            }
        }
    }
    .csrf-info {
        .info-item {
            background: rgba(30, 30, 30, 0.8);
            border-color: rgba(102, 126, 234, 0.2);
            .label {
                color: #ecf0f1;
            }
        }
    }
    .validation-forms {
        .form-group {
            label {
                color: #ecf0f1;
            }
        }
    }
    .tools-demo {
        .tool-group {
            background: rgba(30, 30, 30, 0.8);
            border-color: rgba(102, 126, 234, 0.2);
            h4 {
                color: #ecf0f1;
            }
            .tool-result {
                background: rgba(30, 30, 30, 0.8);
                border-color: rgba(102, 126, 234, 0.2);
                .label {
                    color: #ecf0f1;
                }
            }
        }
    }
    .security-tips {
        .tip-item {
            background: rgba(30, 30, 30, 0.8);
            border-color: rgba(102, 126, 234, 0.2);
            h4 {
                color: #ecf0f1;
            }
            ul li {
                color: #bdc3c7;
            }
        }
    }
}